import { defineComponent, getCurrentInstance, ref } from 'vue'
// 假设自定义指令名为 v-focus
import vFocus from 'src/directives/v-focus'

export default defineComponent({
  name: '指令',
  directives: {
    focus: vFocus,
  },
  emits: ['update:num'],
  setup(props, { emit }) {
    const instance = getCurrentInstance()
    console.log(`instance 👉`, instance)
    const inputRef = ref(null)
    function onClick(params) {
      inputRef.value.focus()
    }
    return () => (
      <div>
        <input ref={inputRef} type="text" v-focus />
        <button onClick={onClick}>Focus Input</button>
        <div class="kkk">yyy</div>
        {/* <button onClick={() => emit('update:num', 99)}>更新父组件 num</button> */}
      </div>
    )
  },
})
